package com.after.saas.system.controller;


import com.after.saas.common.constants.Result;
import com.after.saas.common.model.query.CommonQuery;
import com.after.saas.common.model.vo.AlipayRecordVO;
import com.after.saas.common.utils.ResponseUtil;
import com.after.saas.system.service.AlipayRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author hjchen
 * @since 2021-07-17
 */
@RestController
@Api(tags = "支付宝年度收入支出统计")
@RequestMapping("/alipay-record")
public class AlipayRecordController {

    @Autowired
    private AlipayRecordService alipayRecordService;

    @ApiOperation("年度总收入统计")
    @GetMapping("/perYear")
    public Result<List<AlipayRecordVO>> getYearRecord(CommonQuery query) {
        return ResponseUtil.SUCCESS(alipayRecordService.getYear(query));
    }

    @ApiOperation("月度收入支出统计")
    @GetMapping("/perMonth")
    public Result<List<AlipayRecordVO>> getMonthRecord(CommonQuery query) {
        return ResponseUtil.SUCCESS(alipayRecordService.getMonth(query));
    }

    @ApiOperation("历年的收入统计")
    @GetMapping("/showYearIncome")
    public Result<List<AlipayRecordVO>> yearIncome() {
        return ResponseUtil.SUCCESS(alipayRecordService.getYearIncome());
    }

    @ApiOperation("历年的支出统计")
    @GetMapping("/showYearExpend")
    public Result<List<AlipayRecordVO>> yearExpend() {
        return ResponseUtil.SUCCESS(alipayRecordService.getYearExpend());
    }

    @ApiOperation("月度收入支出统计")
    @GetMapping("/showMonthIncome")
    public Result<List<AlipayRecordVO>> monthIncome(CommonQuery query) {
        return ResponseUtil.SUCCESS(alipayRecordService.getMonthIncome(query));
    }

    @ApiOperation("月度支出金额统计")
    @GetMapping("/showMonthExpend")
    public Result<List<AlipayRecordVO>> monthExpend(CommonQuery query) {
        return ResponseUtil.SUCCESS(alipayRecordService.getMonthExpend(query));
    }

}
